﻿<%@ Page Language="C#" Title="大中修路段页面" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="AddPrimaryProgramPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Repair.PrimaryProgramPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>

    <script type="text/javascript">

        function B_RoadwayEdit() {
            var row = $('#dg').datagrid('getSelected');

            if (!row) {
                $.messager.alert('消息提示', '编辑数据时，请选择一项!', 'warning');
                return;
            }
            $('#fm').form('load', row);
            if (row.Pvmttype_Dictid < 168)
            {
                $('#Pvmttype').combobox("setValue", 21);
            }
            else if (row.Pvmttype_Dictid < 172)
            {
                $('#Pvmttype').combobox("setValue", 22);
            }
            else 
            {
                $('#Pvmttype').combobox("setValue", 23);
            }

            $('#dlg').dialog('open');
        }

        function B_RoadwayDel() {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            deleteData($('#dg'), $('#dlg'), "/api/roadway");
        }



        function search(n, o) {
            var region = $('#cmbRegion').combobox("getValue");
            var direction = $('#cmbDirection').combobox("getValue");
            var checkDate = $('#checkDate').datebox('getValue');  //注意.datebox('getValue')

            var url = '/api/roadway';
            var urlParam = "";
            if (region != "" && region != "0") urlParam += "region=" + encodeURI(region) + "&";
            if (direction != "" && direction != "0") urlParam += "direction=" + encodeURI(direction) + "&";
            if (checkDate != "") urlParam += "checkDate=" + encodeURI(checkDate) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }

        function sumbitData1() {

            $.messager.progress({
                title: '请等待',
                msg: '加载数据中...'
            });

            $("form").ajaxSubmit({
                complete: function () {
                    $.messager.progress('close');
                },
                success: function (responseText) {
                    window.location.replace('/dr_list');
                    $('#dlg').dialog('close');
                },
                error: function (err) {
                    $.messager.alert('错误提示', err.responseJSON.ExceptionMessage, "error");
                }
            });
        }

        $(function () {
            var number = '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            //loadAdmDiv();
            dataGridBind($('#dg'), 'api/repair/seg', '大中修路段', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });

            $('#Design_Time').datebox('setValue', formatterDate(new Date()));
        })

    </script>    

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <tr>
                <th data-options="field:'Divi_Time',editor:'datebox',width:160,align:'right' ">划分时间</th>
                <th data-options="field:'Rdwayid',editor:'text',width:200,align:'right' ">路线编号</th>
                <th data-options="field:'Mainsegid',editor:'text',width:160,align:'right' " >路段编号</th>
                <th data-options="field:'Beginmp',editor:'numberbox',width:160,align:'right' " formatter="formatPile">起点桩号</th>
                <th data-options="field:'Endmp',editor:'numberbox',width:160,align:'right' " formatter="formatPile">终点桩号 </th>
                <th data-options="field:'Rdclass_Dictid',editor:'text',width:160,align:'right' " formatter="formatRoadClass">公路等级</th>
                <th data-options="field:'Pvmttype_Dictid',editor:'text',width:160,align:'right' " formatter="formatRoadSurface">路面类型</th>
            </tr>
        </thead>
    </table>
   
    <div id="tb">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="B_RoadwayEdit()">添加养护初选方案</a> 
    </div>


    <div id="dlg" class="easyui-dialog" title="大中修路段设计" style="width:300px;height:280px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttons'">
        <form id="fm" method="post" action="api/repair/add">
            <table>			     
                <tr>
                    <td>路线名称:</td>
                    <td><input name='Rdwayid' class='easyui-validatebox  easyui-textbox' data-options="readonly:true"  /></td>
                </tr>
                <tr>
                    <td>养护路段:</td>
                    <td><input name='Mainsegid' class='easyui-validatebox easyui-textbox'  data-options="readonly:true" /></td>
                </tr>
                <tr>
                    <td>路面类型:</td>
                    <td><select class="easyui-combobox" name="Pvmttype" id="Pvmttype" style="width:170px;" data-options='readonly:true'>
		                    <option value="21">沥青路面</option>
		                    <option value="22">水泥路面</option>
		                    <option value="23">砂石路面</option>
	                    </select>
                    </td>
                </tr>
                <tr>
                    <td>技术等级:</td>      
                    <td><select class="easyui-combobox" name="Rdclass_Dictid" id="Rdclass_Dictid" style="width:170px;" data-options='readonly:true'>
		                    <option value="160">高速公路</option>
		                    <option value="161">一级公路</option>
		                    <option value="162">二级公路</option>
		                    <option value="163">三级公路</option>
		                    <option value="164">四级公路</option>
	                    </select>
                    </td>
                </tr>
                <tr>
                    <td>方案名称:</td>
                    <td><input name='Meas_Name' class='easyui-validatebox easyui-textbox' data-options="required:true" /></td>
                </tr>
                <tr style="display:none">
                    <td>设计时间:</td>
                    <td><input id='Design_Time' name='DESIGN_TIME' class='easyui-datebox' /></td>
                </tr>
                <tr style="display:none">
                    <td>划分时间:</td>
                    <td><input  name='Divi_Time' class='easyui-datebox' data-options="required:true"/></td>
                </tr>
		    </table>
        </form>
    </div>

    <div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="sumbitData1()">确定</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>
</asp:Content>
